<?php
/* @var $this UserAdminController */
/* @var $model User */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'user-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
)); ?>
	<?php $is_visible = Administator::model()->checkAdmin();?>

	<?php echo $form->errorSummary($model); ?>
	<?php if($is_visible): ?>
	<div class="row">
		<?php echo $form->labelEx($model,'username'); ?>
		<?php echo $form->textField($model,'username',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'username'); ?>
	</div>
	<?php endif; ?>
	<div class="row">
		<?php echo $form->labelEx($model,'password'); ?>
		<?php echo $form->passwordField($model,'password',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'password'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'email'); ?>
		<?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'email'); ?>
	</div>

	<?php if($is_visible): ?>
	<div class="row">
		<?php echo $form->labelEx($model,'is_admin'); ?>
		 <?php echo CHtml::dropDownList('User[is_admin]', 'is_admin',array('1'=>'Người dùng quản trị','0'=>'Người dùng thường')); ?>
		<?php echo $form->error($model,'is_admin'); ?>
	</div>


	<div class="row">
		<?php echo $form->labelEx($model,'status'); ?>
		<?php echo CHtml::dropDownList('User[status]', 'status',array('1'=>'Đang hoạt động','0'=>'Ngừng hoạt động')); ?>
		<?php echo $form->error($model,'status'); ?>
	</div>
	<?php endif; ?>
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Tạo' : 'Lưu'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->